@extends('edu.layouts.default')
@section('content')
    <div class="card">
        <div class="card-body">
            <ul class="nav nav-tabs nav-overflow header-tabs">
                <li class="nav-item">
                    <a href="{{route('edu.lesson.lists')}}" class="nav-link pb-3 active">
                        课程列表
                    </a>
                </li>
                <li class="nav-item">
                    <a href="{{route('edu.lesson.create')}}" class="nav-link pb-3">
                        新增课程
                    </a>
                </li>
            </ul>
        </div>
        <div class="card-body small">
            <table class="table">
                <thead>
                <tr>
                    <th>编号</th>
                    <th>课程名称</th>
                    <th>视频数量</th>
                    <th>创建时间</th>
                    <th></th>
                </tr>
                </thead>
                <tbody>
                @foreach($lessons as $lesson)
                    <tr>
                        <td scope="row">{{$lesson['id']}}</td>
                        <td>{{$lesson['title']}}</td>
                        <td>{{$lesson->video_num}}</td>
                        <td>{{$lesson->created_at}}</td>
                        <td class="text-right">
                            <div class="btn-group btn-group-sm" role="group" aria-label="First group">
                                <a href="{{route('edu.lesson.edit',$lesson)}}" class="btn btn-light">编辑课程</a>
                                <button type="button" class="btn btn-white" onclick="del({{$lesson['id']}})">删除课程
                                </button>
                                <form action="{{route('edu.lesson.destroy',$lesson)}}" method="post" id="{{$lesson['id']}}">
                                    @csrf @method('DELETE')
                                </form>
                            </div>
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
        </div>
    </div>
@endsection
